#include <stdio.h>
#include <string.h>

typedef struct Date
{
	int iYear;
	int iMonth;
	int iDay;
}Date;

typedef struct STU
{
	int iId;
	char caName[32];
	float fScore;
	Date born;
}STU;

int main(void)
{
	STU stu[3];
	int i=0;
	for (; i<3; i++)
	{
		printf("请输入学生的id,name,score:\n");
		scanf("%d%s%f", &stu[i].iId
					  , stu[i].caName
					  , &stu[i].fScore);
		printf("请输入学生的生日(年月日):\n");
		scanf("%d%d%d", &stu[i].born.iYear
					  , &stu[i].born.iMonth
					  , &stu[i].born.iDay);
	}

	printf("\n--------------------\n\n");
	for (i=0; i<3; i++)
	{
		printf("id:%d,name:%s,score:%.2f\n\
born:%d-%d-%d, age:%d\n", stu[i].iId, stu[i].caName
        	    , stu[i].fScore, stu[i].born.iYear
		   	    , stu[i].born.iMonth
		        , stu[i].born.iDay
				, (2019-stu[i].born.iYear));
	}
	float fSumScore = 0;
	float fSumAge = 0;
	for (i=0; i<3; i++)
	{
		fSumScore += stu[i].fScore;	
		fSumAge += (2019-stu[i].born.iYear);
	}
	printf("总分:%.2f\n平均分:%.2f\n平均年龄:%.2f\n", fSumScore, fSumScore/3, fSumAge/3);

	return 0;
}
